import React from 'react';
import './App.css';
import List from './List';
import Item from './Item';


export default class App extends React.Component {
  
  constructor(props){
    super(props)
    this.state = {
      disk:[]
    }
   
  }

  handleChange = (e) => {
      this.state.disk.push(e)
      this.setState({
       
      })  
  }

  handleDelete = (e) => {
    console.log(e)
    console.log(this.state.disk.indexOf(e))
    this.state.disk.splice(this.state.disk.indexOf(e),1)
    this.setState({
      
    })
  }

  componentDidUpdate() {
    console.log("更新完毕")
  }
  aaa = () => {
    console.log(this.state.disk)
  }

  render(){
    return (
      <div className="App">
      
        <List onHandleChange={this.handleChange}></List>
        <Item txt={this.state.disk} onHandleDelete={this.handleDelete}></Item>
      </div>
    );
  }
}


